﻿using BookingSystemModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using WcfBookingService.DataLayer;

namespace WcfBookingService
{
    public class InternalBookingService : IInternalBookingService
    {
        private DbHandler dbHandler = null;
        private PhoneManager phoneManager = null;
        private SubscriptionManager subscriptionManager = null;
        
        public InternalBookingService()
        {
            dbHandler = new DbHandler();
            phoneManager = new PhoneManager(dbHandler);
            subscriptionManager = new SubscriptionManager(dbHandler);
            
        }

        /// <summary>
        /// Create a new subscription
        /// </summary>
        /// <param name="_title"></param>
        /// <param name="_description"></param>
        /// <param name="_attendeeAmount"></param>
        /// <param name="_start"></param>
        /// <param name="_end"></param>
        /// <param name="_payee"></param>
        /// <param name="_note"></param>
        /// <returns></returns>
        public int CreateSubscription(Subscription subscription)
        {
            return subscriptionManager.CreateSubscription(subscription);
            //return subscriptionManager.CreateSubscription(_title, _description, _attendeeAmount, _start, _end, _payee, _note);
        }
        /*
        /// <summary>
        /// Create a new phone
        /// </summary>
        /// <param name="isPrimary">Is primary phone?</param>
        /// <param name="extension">Dial extension number</param>
        /// <param name="countryCode">Country code</param>
        /// <param name="areaCode">Area code</param>
        /// <param name="number">Phone number</param>
        public void CreatePhone(bool isPrimary, int? extension, int? countryCode, int? areaCode, int number)
        {
            phoneManager.CreatePhone(isPrimary, extension, countryCode, areaCode, number);
        }

        /// <summary>
        /// Get a phone
        /// </summary>
        /// <param name="phoneNumber">Phone number</param>
        /// <returns>Phone object or null</returns>
        public Phone GetPhone(int phoneNumber)
        {
            return phoneManager.GetPhone(phoneNumber);
        }

        /// <summary>
        /// Get all phones
        /// </summary>
        /// <returns>List containing list of Phone objects or null</returns>
        public List<Phone> GetAllPhones()
        {
            return phoneManager.GetAllPhones();
        }

        /// <summary>
        /// Update a phone
        /// </summary>
        /// <param name="phone">Phone object</param>
        /// <returns>TRUE if updated</returns>
        public Boolean UpdatePhone(Phone phone)
        {
            return phoneManager.UpdatePhone(phone);
        }


        public Boolean DeletePhone(Int32 id)
        {
            return phoneManager.DeletePhone(id);
        }*/
    }
}